//
//  RepairVC.m
//  CJRailTransport
//
//  Created by Hank on 2018/1/22.
//  Copyright © 2018年 amplity. All rights reserved.
//
#define ReportLossTitle          @"请选择报销单"

#import "RepairVC.h"
#import "STPickerSingle.h"
#import "UIButton+Expand.h"
#import "UILabel+Expand.h"

@interface RepairVC ()<STPickerSingleDelegate>

@end

@implementation RepairVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // 设置导航栏
    [self setNavC];
    // 设置界面属性
    [self setViewAttribute];
    // 设置圆角
    [self setRadius];
}

#pragma mark - 导航栏
- (void)setNavC
{
    self.title = @"维修";
    // 设置导航栏颜色
    BasicNavigationController *nVC = (BasicNavigationController *)self.navigationController;
    nVC.themeColor = [UIColor whiteColor];
    nVC.tintColor = [UIColor darkGrayColor];
}

// 设置界面属性
- (void)setViewAttribute
{
    self.view.backgroundColor = [UIColor whiteColor];
}

#pragma mark - Radius
// 设置圆角
- (void)setRadius
{
    [self.reportLossBtn radiusBtn:3 backgroundColor:[UIColor clearColor] borderWidth:0.5 borderColor:DefaultRadiusGray];
    [self.repairDate radiusLabel:3 backgroundColor:[UIColor clearColor] borderWidth:0.5 borderColor:DefaultRadiusGray];
    [self.repairLocation radiusLabel:3 backgroundColor:[UIColor clearColor] borderWidth:0.5 borderColor:DefaultRadiusGray];
    [self.supplier radiusLabel:3 backgroundColor:[UIColor clearColor] borderWidth:0.5 borderColor:DefaultRadiusGray];
    // 设置TextView圆角
    self.repairResultsTV.layer.cornerRadius = 3;
    self.repairResultsTV.layer.backgroundColor = [UIColor clearColor].CGColor;
    self.repairResultsTV.layer.borderWidth = 0.5;
    self.repairResultsTV.layer.borderColor = DefaultRadiusGray.CGColor;
}

#pragma mark - Picker
// 显示内容选择器
- (void)showContentPicker:(NSMutableArray *)dataArray pickerTitle:(NSString *)pickerTitle
{
    // 创建内容选择器
    STPickerSingle *pickerSingle = [[STPickerSingle alloc]init];
    // 添加数据
    [pickerSingle setArrayData:dataArray];
    // 添加标题
    [pickerSingle setTitle:pickerTitle];
    [pickerSingle setContentMode:STPickerContentModeBottom];
    [pickerSingle setDelegate:self];
    // 显示内容选择器
    [pickerSingle show];
}

#pragma mark - Action
// 报销单 Action
- (IBAction)reportLossAction:(UIButton *)sender
{
    // 显示内容选择器
    [self showContentPicker:[NSMutableArray arrayWithArray:@[@"报销单测试1",@"报销单测试2",@"报销单测试3",@"报销单测试4",@"报销单测试5",@"报销单测试6"]] pickerTitle:ReportLossTitle];
}

#pragma mark - pickerDateDelegate
// content
- (void)pickerSingle:(STPickerSingle *)pickerSingle selectedTitle:(NSString *)selectedTitle
{
    [self.reportLossBtn setTitle:[NSString stringWithFormat:@"  %@", selectedTitle] forState:UIControlStateNormal];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
